<%-- 
    Document   : signList
    Created on : Aug 28, 2012, 8:35:36 PM
    Author     : phong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>        
        <f:view>            
                <a href="signList.jsp">Sign List</a>&nbsp;|&nbsp;
                <a href="viewStatic.jsp">View Static</a>&nbsp;|&nbsp;
                <a href="reportList.jsp">Report Static</a>
                <h1>Sign List</h1>  
                <h:form id="signList">  
                    Use Date: <h:inputText  value="#{signListBean.useDate}"/>
                    <h:selectOneMenu value="#{signListBean.status}">
                        <f:selectItem  itemLabel="All" itemValue="All"></f:selectItem>
                        <f:selectItem  itemLabel="Request" itemValue="Request"></f:selectItem>
                        <f:selectItem  itemLabel="Deny" itemValue="Deny"></f:selectItem>
                        <f:selectItem  itemLabel="Approve" itemValue="Approve"></f:selectItem>
                        <f:selectItem  itemLabel="Done" itemValue="Done"></f:selectItem>
                    </h:selectOneMenu>            
                    <h:selectOneMenu value="#{signListBean.timeTableId}">
                        <f:selectItem  itemLabel="All" itemValue="All"></f:selectItem>
                        <f:selectItem  itemLabel="T1: 7:30 - 9:30" itemValue="T1"></f:selectItem>
                        <f:selectItem  itemLabel="T2: 9:30 - 11:30" itemValue="T2"></f:selectItem>
                        <f:selectItem  itemLabel="T3: 13:30 - 15:30" itemValue="T3"></f:selectItem>
                        <f:selectItem  itemLabel="T4: 15:30 - 17:30" itemValue="T4"></f:selectItem>
                    </h:selectOneMenu>
                    <h:commandButton value="Search" action="search"/>         
                    <h:dataTable var="sign" value="#{signListBean.signLabByAdmin}" border="1" >
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Id"/>
                            </f:facet>
                            <h:outputText value="#{sign.id}"/>
                        </h:column>                   
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Signer Name"/>
                            </f:facet>
                            <h:commandLink value="#{sign.user.name}" action="userInfo" 
                                           actionListener="#{userBean.getUserByID(sign.user.id)}"/>  
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Lab ID"/>
                            </f:facet>
                            <h:commandLink value="#{sign.lab.id}" action="labInfo" actionListener="#{labBean.getLabByID(sign.lab.id)}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Create Date"/>
                            </f:facet>
                            <h:outputText value="#{sign.createDate}">
                                <f:convertDateTime pattern="HH:mm MM/dd/yyyy" />
                            </h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Time Table"/>
                            </f:facet>
                            <h:outputText value="#{sign.timeTable.id}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Use Date"/>
                            </f:facet>
                            <h:outputText value="#{sign.useDate}">
                                <f:convertDateTime pattern="MM/dd/yyyy" />
                            </h:outputText>
                        </h:column>                   
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Status"/>
                            </f:facet>
                            <h:outputText value="#{sign.status}"/>
                        </h:column>                    
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Action"/>
                            </f:facet>
                            <h:commandLink value="Deny" action="sucess" actionListener="#{signLabBean.denySignLab}"
                                           rendered="#{dateUlti.futureDate(sign.useDate)}">
                                <f:param id="signDenyID" name="signID" value="#{sign.id}"/>                            
                            </h:commandLink>             
                            &nbsp;&nbsp;
                            <h:commandLink value="Approve" action="sucess" actionListener="#{signLabBean.approveSignLab}"
                                           rendered="#{dateUlti.futureDate(sign.useDate) &&
                                                       signLabBean.checkFreeLab(sign.lab.id,sign.timeTable.id,sign.useDate)}">
                                <f:param  id="signApproveID" name="signID" value="#{sign.id}"/>
                            </h:commandLink>
                        </h:column>
                    </h:dataTable>
                </h:form>            
        </f:view>
    </body>
</html>
